package com.soilflow.web.controller.soilflow;

import com.soilflow.common.core.controller.BaseController;
import com.soilflow.common.core.domain.AjaxResult;
import com.soilflow.common.core.page.TableDataInfo;

import com.soilflow.common.domain.LandCarouselChart;
import com.soilflow.info.service.LandCarouselChartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 新闻信息
 */
@RestController
@RequestMapping("/land/carouse")
public class LandCarouseChartController extends BaseController {

    @Autowired
    private LandCarouselChartService landCarouselChartService;


    /**
     * 更新法律信息
     * @param dto
     * @return
     */
    @PostMapping("/add")
    public AjaxResult addLandCarouseChart(@RequestBody LandCarouselChart dto){
        landCarouselChartService.updateLandCarouselChart(dto);
        return AjaxResult.success();
    }



    /**
     * 更新法律信息
     * @param dto
     * @return
     */
    @PutMapping("/update")
    public AjaxResult updateLandCarouseChart(@RequestBody LandCarouselChart dto){
        landCarouselChartService.updateLandCarouselChart(dto);
        return AjaxResult.success();
    }

    /**
     * 回显详情
     * @return
     */
    @GetMapping("/detail")
    public AjaxResult getLandCarouseChartById(){
        List<LandCarouselChart> list = landCarouselChartService.list();
        LandCarouselChart landCarouselChart=new LandCarouselChart();
        if (list.size()>0){
         landCarouselChart = list.get(0);
        }
        return AjaxResult.success(landCarouselChart);
    }
}
